﻿@using Scorpicore.MVC.Models;
@model Int32?
@{
    ViewBag.Title = "Топ 10 най-регистрирани банкноти";
}

<h2 class="legend-title">Топ 10 най-регистрирани банкноти</h2>

@(Html.Kendo()
    .Grid<TopTenBanknoteViewModel>()
    .Name("registered-banknotes")
    .Columns(col =>
        {
            col.Bound(b => b.ImageUrl).ClientTemplate("<img src='#: ImageUrl #' style='width:55px;height:30px' />").Width(50);
            col.Bound(m => m.Letters);
            col.Bound(m => m.SerialNumber);
            col.Bound(m => m.Denomination);
            col.Bound(m => m.LastPlace);
            col.Bound(m => m.Distance);
            col.Bound(m => m.SerialNumber).ClientTemplate(
                
//                 @using (Html.BeginForm("ChooseBanknote", "Banknote", FormMethod.Post))
//{
//        <input type="submit" value="Покажи" class="btn-my-submit btn" />
                //}




                @Html.ActionLink("Проследи", "RedirectFromGrid", "Banknote",
                             new
                             {
                                 letters = "#= Letters #",
                                 serialNumber ="#= SerialNumber #"
                             }, null)
                             .ToHtmlString()).Title(" ");
        })
    .DataSource(data =>
        {
            data.Ajax()
                .Model(m => m.Id(b => b.Id))
                .ServerOperation(true)
                .Read("ReadTopTenBanknotes", "TopTen", new { denom = Model});
        })
            .Events(events => events.DataBound("dataBound"))
            @*.DetailTemplate(
                @<text></text>
                //Html.Kendo().Grid<Scorpicore.Models.Track>()
                //    .Name("gr")
                //    ;
                )*@
.ClientDetailTemplateId("template")
)

<h3 id="other-topTen">Други Топ10 репорти</h3>
<div class="other-reports-container">
    @Html.ActionLink("2лв.", "RegisterBanknotes", new { denom = 2 }, new { @class = "other-report" })
    @Html.ActionLink("5лв.", "RegisterBanknotes", new { denom = 5 }, new { @class = "other-report fiveLv" })
    @Html.ActionLink("10лв.", "RegisterBanknotes", new { denom = 10 }, new { @class = "other-report" })
    @Html.ActionLink("20лв.", "RegisterBanknotes", new { denom = 20 }, new { @class = "other-report" })
    @Html.ActionLink("50лв.", "RegisterBanknotes", new { denom = 50 }, new { @class = "other-report" })
    @Html.ActionLink("100лв.", "RegisterBanknotes", new { denom = 100 }, new { @class = "other-report" })
</div>

<script>
    function dataBound() {
        this.expandRow(this.tbody.find("tr.k-master-row").first());
    }

    function renderNumber(data) {
        switch (data) {
            case "five": return "5 лв."
                break;
            case "Twenty": return "20 лв."
                break;
            default:
                return "error"
        }
    }

</script>

<script id="template" type="text/x-kendo-template">
    <strong>Следи</strong>
    @(Html.Kendo().Grid<TracksInTopTenBanknotesViewModel>()
                    .Name("grid_#=Id#")
                            .Columns(col =>
                {
                    col.Bound(b => b.Place);
                    col.Bound(b => b.User).ClientTemplate("<a href='/Home/GetNameToSearch?name=\\#:User\\#' >\\#:User\\#</a>");
                    col.Bound(m => m.Message);
                    col.Bound(m => m.Date);
                })
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .PageSize(5)
                        .Read(read => read.Action("ReadTracks", "TopTen", new { Id = "#=Id#" }))
                    )
                    .Pageable()
                    .Sortable()
                    .ToClientTemplate())
</script>
